<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateActivityBargainAllTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //砍价活动表
        Schema::create('activity_bargain', function(Blueprint $table) {
            $table->increments('id')->comment('自增id');
            $table->integer('goods_id')->default(0)->comment('商品id');
            $table->decimal('max_money')->default(0)->comment('砍价的最大金额');
            $table->integer('max_join_count')->default(0)->comment('最大参与人数');
            $table->timestamp('start_time')->nullable()->comment('活动开始时间');
            $table->timestamp('end_time')->nullable()->comment('活动结束时间');
            $table->integer('status')->default(0)->comment('状态：0：下架 1：上架');
            $table->softDeletes();
            $table->timestamps();
        });

        //发起砍价活动表
        Schema::create('activity_bargain_initiate', function(Blueprint $table) {
            $table->increments('id')->comment('自增id');
            $table->integer('user_id')->default(0)->comment('发起用户id');
            $table->integer('ab_id')->default(0)->comment('活动id');
            $table->integer('goods_id')->default(0)->comment('商品id');
            $table->integer('goods_spu_id')->default(0)->comment('商品属性id');
            $table->decimal('finally_money')->default(0)->comment('最终金额');
            $table->integer('bargain_num')->default(0)->comment('砍价次数');
            $table->timestamp('end_time')->nullable()->comment('砍价结束时间');
            $table->string('order_num')->nullable()->comment('订单编号');
            $table->integer('share_img_id')->default(0)->comment('分享图片id');
            $table->string('remark')->nullable()->comment('备注');
            $table->integer('status')->default(0)->comment('状态：-1：取消 0：正常 1：完成');
            $table->softDeletes();
            $table->timestamps();
        });

        //参与砍价活动表
        Schema::create('activity_bargain_join', function(Blueprint $table) {
            $table->increments('id')->comment('自增id');
            $table->integer('user_id')->default(0)->comment('砍价的用户id');
            $table->integer('abi_id')->default(0)->comment('活动id');
            $table->timestamp('participate_time')->nullable()->comment('参与时间');
            $table->decimal('bargain_money')->default(0)->comment('砍掉的价格');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
